﻿/* mvcForum
 * Copyright (C) 2010-2011 Steen F. Tøttrup
 * http://mvcforum.org/
 */

using System;
using System.ComponentModel.DataAnnotations;

namespace mvcForum.Core {

	public class BannedIP {
		public BannedIP() { }
		public BannedIP(String ip) {
			this.IP = ip;
			this.Timestamp = DateTime.UtcNow;
		}

		#region Properties
		/// <summary>
		/// The Id of the banned IP address.
		/// </summary>
		public Int32 Id { get; set; }
		/// <summary>
		/// The banned IP address.
		/// </summary>
		[StringLength(Constants.FieldLengths.IPAddress)]
		[Required]
		public String IP { get; set; }
		private DateTime timestamp;
		/// <summary>
		/// Timestamp of when the IP address was banned.
		/// </summary>
		[Required]
		public DateTime Timestamp {
			get {
				return this.timestamp;
			}
			set {
				this.timestamp = value.Handle();
			}
		}
		#endregion
	}
}